<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">
<title>图书详情</title>
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/index.css">
<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>
<script src="${pageContext.request.contextPath}/js/getParam.js"></script>
<script>
	function joinCarBtn(){
		//获取gid
		var goodsid = getParam.id;
		//获取nums
		var nums = document.getElementById("buyNums").value;

		$.post("${pageContext.request.contextPath}/cart/add", "id="+goodsid+"&nums="+nums, function(data) {
			//alert(num+"件添加成功");
		})
	}
	
	window.onload = function(){
		//实现数字增加和减少
        document.getElementById("add").onclick = function(){
            var buyNums = document.getElementById("buyNums").value;
            var num = Number(buyNums);
            num++;
            document.getElementById("buyNums").value = String(num);
        }
        document.getElementById("reduce").onclick = function(){
            var buyNums = document.getElementById("buyNums").value;
            var num = Number(buyNums);
            if(num <= 1){
                document.getElementById("buyNums").value = "1";
            }else{
                num--;
                document.getElementById("buyNums").value = String(num);
            }
        }
        
        //1430749369016
        //立即购买buyNowBtn
        document.getElementById("buyNowBtn").onclick = function(){
			var id = document.getElementById("data_goodsId").value;
			var nums = document.getElementById("buyNums").value;
			//alert(goodsid);
			location.href="${pageContext.request.contextPath}/cart/buyNow?id="+id+"&nums="+nums+"&goodsid="+id;
        }
    }
</script>
<style>
#grade {
	height: 34px
}

#grade>ul {
	height: 18px
}

#grade>ul>li {
	margin: 0
}
</style>
</head>
<body class="index">
	<div id="content"></div>
	<div class="container">
		<div class="header" id="header">
			<h1 class="logo">
				<a title="" style="background: url(${pageContext.request.contextPath }/images/logo.png);" href="${pageContext.request.contextPath }/index.jsp">电子商务平台</a>
			</h1>
			
		<ul class="shortcut"><li class="first"><a href="personal.html">个人中心</a></li><li><a href="myOrders.html">我的订单</a></li></ul><p class="loginfo">你好!17760990684[<a href="javaScript:logout()">安全退出</a>]</p></div>
		<div class="navbar">
			<ul id="goodsType">
				<li><a href="goods.html?gtid=0">首页</a></li>
				
			 <li><a href="goods.html?gtid=1">IT技术</a></li> <li><a href="goods.html?gtid=2">历史传记</a></li> <li><a href="goods.html?gtid=3">小说</a></li> <li><a href="goods.html?gtid=4">生活</a></li> <li><a href="goods.html?gtid=5">经营管理</a></li></ul>
			<div class="mycart">
				<dl>
					<dt>
						<a href="${pageContext.request.contextPath}/cart/showCart">购物车<b name="mycart_nums" id="mycart_nums">0</b>件
						</a>
					</dt>
					<dd>
						<a href="cart.html">去结算</a>
					</dd>
				</dl>
				<!--购物车浮动div 开始-->
				<div class="shopping" id="div_mycart" style="display: none;">
					<dl class="cartlist" id="shopcarDiv">
					</dl>
				</div>

			</div>
		</div>
		<div class="searchbar">
			<div class="allsort">
				<a href="javascript:void(0);">全部商品分类</a>
				<!--总的商品分类-开始-->
				<ul class="sortlist" id="div_allsort" style="display: none"><li><h2><a href="goods.html?gtid=1">IT技术</a></h2></li><li><h2><a href="goods.html?gtid=2">历史传记</a></h2></li><li><h2><a href="goods.html?gtid=3">小说</a></h2></li><li><h2><a href="goods.html?gtid=4">生活</a></h2></li><li><h2><a href="goods.html?gtid=5">经营管理</a></h2></li></ul>
			</div>
			<script>
				
			</script>

			<div class="searchbox">
				<input class="text" type="text" name="q" autocomplete="off" placeholder="输入关键字..." id="word"> <input class="btn" type="button" value="商品搜索" id="search-btn">

			</div>
			<div class="hotwords">
				热门搜索：IT
			</div>
		</div>
		<div class="wrapper clearfix">
			<div class="summary">
				<h2 id="title">${goods.name }</h2>
				<!--基本信息区域-->
				<ul id="infor">
					<li>
						<span class="f_r light_gray">图书编号：<label id="data_goodsNo">${goods.goodsno}</label></span>
						<input type="hidden" value="${goods.id}" id="data_goodsId">
					</li>
					<li id="priceLi">销售价：￥<b class="price red2">
						<span class="f30" id="real_price">${goods.salesprice}</span>
						</b>
					</li>
					<li>
						市场价：￥<del id="data_marketPrice">${goods.marketprice}</del>
					</li>
					<li>
						作者：${goods.author}</li><li>出版社：${goods.publisher}
					</li>
					<li>
						出版时间：${goods.pubtime}
					</li>
					<li>
						库存：现货<span>(<label id="data_storeNums">${goods.stock}</label>)</span>
						
					</li>
				</ul>
				<div class="current">
					<dl class="m_10 clearfix">
						<dt>购买数量：</dt>
						<dd>
							<input class="gray_t f_l" type="text" id="buyNums" value="1" maxlength="5">
							<div class="resize">
								<a class="add" id="add"></a> <a class="reduce" id="reduce"></a>
							</div>
						</dd>
					</dl>
					<input class="submit_buy" type="button" id="buyNowBtn" value="立即购买">
					
					<div class="shop_cart" style="z-index: 1">
						<input class="submit_join" type="button" id="joinCarBtn" value="加入购物车" onclick="joinCarBtn()">
						<div class="shopping" id="product_myCart" style="display: none">
							<dl class="cart_stats">
								<dt class="gray f14 bold">
									<a class="close_2 f_r" href="javascript:closeCartDiv();" title="关闭">关闭</a> <img src="${pageContext.request.contextPath }/images/front/right_s.gif" width="24" height="24" alt="">成功加入购物车
								</dt>
								<dd>
									<a class="btn_blue bold" href="cart?opr=view">进入购物车</a><a class="btn_blue bold" href="javascript:void(0)" onclick="closeCartDiv();">继续购物&gt;&gt;</a>
								</dd>
							</dl>
						</div>
					</div>
				</div>
			</div>

			<div>
				<div class="pic_show" style="width: 335px; height: 335px; position: relative; z-index: 5; padding-bottom: 5px;">
					<img src="${pageContext.request.contextPath}/${goods.image}" title="${goods.name }" style="border: none; width: 335px; height: 335px" id="pic">
				</div>
			</div>
		</div>

		<div class="wrapper clearfix container_2">
			<!--左边栏-->
			<div class="sidebar f_l">
				<!-- 				<div class="box m_10">
					<div class="title">购买本商品的用户还购买过</div>
					<div class="content">
						<ul class="ranklist">
							<li class="current"><a
								href="/shop/index.php?controller=site&action=products&id=1"><img
									width="58px" height="58px" src="/shop/"></a> <a
								title="Java编程思想" class="p_name"
								href="/shop/index.php?controller=site&action=products&id=1">Java编程思想</a>
								<b>￥89.00</b></li>
						</ul>
					</div>
				</div> -->
			</div>

			
		</div>
		<div class="help m_10">
			<div class="cont clearfix">
				<dl>
					<dt>
						<a href="">购物指南</a>
					</dt>
					<dd>
						<a href="">订单状态</a>
					</dd>
					<dd>
						<a href="">购物流程</a>
					</dd>
				</dl>
				<dl>
					<dt>
						<a href="">支付帮助</a>
					</dt>
					<dd>
						<a href="">支付帮助</a>
					</dd>
					<dd>
						<a href="">在线支付</a>
					</dd>
					<dd>
						<a href="">货到付款</a>
					</dd>
				</dl>
				<dl>
					<dt>
						<a href="">配送帮助</a>
					</dt>
					<dd>
						<a href="">EMS/邮政普包</a>
					</dd>
					<dd>
						<a href="">商品验货与签收</a>
					</dd>
					<dd>
						<a href="">配送范围及运费</a>
					</dd>
				</dl>
				<dl>
					<dt>
						<a href="">售后服务</a>
					</dt>
					<dd>
						<a href="">售后服务</a>
					</dd>
					<dd>
						<a href="">发票制度</a>
					</dd>
					<dd>
						<a href="">退货说明</a>
					</dd>
					<dd>
						<a href="">换货说明</a>
					</dd>
				</dl>
				<dl>
					<dt>
						<a href="">帮助信息</a>
					</dt>
					<dd>
						<a href="">友情链接</a>
					</dd>
					<dd>
						<a href="">联系客服</a>
					</dd>
					<dd>
						<a href="">找回密码</a>
					</dd>
					<dd>
						<a href="">关于我们</a>
					</dd>
				</dl>
			</div>
		</div>
		<div class="footer">
			<p class="links">
				<a href="">关于我们</a>|<a href="">常见问题</a>|<a href="">安全交易</a>|<a href="">购买流程</a>|<a href="">如何付款</a>|<a href="">联系我们</a>|<a href="">合作提案</a>
			</p>
			Copyright © 2015-2021 <a class="copyys" target="_blank" href="">蜀ICP备01000010号</a>
		</div>
	</div>

</body></html>